package com.zzs.client.dao.mysql;

import com.zzs.common.core.entity.mysql.ProblemDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zzs
 * @date 2025/03/25
 */
@Mapper
public interface ProblemMapper {
    @Select("select id, title, content, difficulty from problem where id = #{id}")
    ProblemDO get(@Param("id") long id);

    /**
     * 查询已经发布的, 对应难度的题目id集合, 如果difficulty为null, 返回所有已发布的id集合
     */
    List<Long> listPublishIds(@Param("difficulty") Integer difficulty);

    List<ProblemDO> listPublishProblemsByIds(@Param("problemIdList") List<Long> problemIdList);

    List<ProblemDO> listPublishProblems(@Param("difficulty") Integer difficulty, @Param("keyword") String keyword);
}
